package com.ssyx.home.controller;

import com.ssyx.common.auth.AuthContextHolder;
import com.ssyx.common.result.Result;
import com.ssyx.home.service.HomeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * ClassName:HomeApiController
 * Description:
 *
 * @Author kay
 * @Create 2024/5/15 16:17
 * @Version 1.0
 */
@Tag(name = "首页接口")
@RestController
@RequestMapping("api/home")
public class HomeApiController {

    @Autowired
    private HomeService homeService;

    @Operation(summary = "首页数据显示接口")
    @GetMapping("index")
    public Result index(HttpServletRequest request){
        Long userId = AuthContextHolder.getUserLoginVo().getUserId();
        Map<String,Object> map = homeService.homeData(userId);
        return Result.ok(map);
    }
}
